#使用示例
#source ./src/set_env_mindie_all.sh /deepseek/mindie-ascend-deploy/new_rank_table_file.json
#取消某环境需要 unset

if [ -z "$RANKTABLEFILE" ]; then
	export RANKTABLEFILE=$1
fi
if [ -z "$RANKTABLEFILE" ]; then
	echo "RANKTABLEFILE should be set"
	exit 1
fi

if [ -z "$MIES_CONTAINER_IP" ]; then
	echo "MIES_CONTAINER_IP should be set"
	exit 1
fi

export ATB_LLM_HCCL_ENABLE=1
export ATB_LLM_COMM_BACKEND="hccl"
export HCCL_CONNECT_TIMEOUT=7200
# 4机设置32卡 2机设置16卡
export WORLD_SIZE=32
export HCCL_EXEC_TIMEOUT=0
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
export NPU_MEMORY_FRACTION=0.96

#export OMP_NUM_THREADS=1
#export ATB_WORKSPACE_MEM_ALLOC_ALG_TYPE=3
#export HCCL_OP_EXPANSION_MODE="AIV"
#export HCCL_RDMA_PCIE_DIRECT_POST_NOSTRICT=True
#开启查看服务具体报错
#export MINDIE_LOG_TO_STDOUT=1

export ATB_WORKSPACE_MEM_ALLOC_ALG_TYPE=2
export CPU_AFFINITY_CONF=2
export OMP_NUM_THREADS=8
export TASK_QUEUE_ENABLE=2
export BIND_CPU=1

# unset ATB_WORKSPACE_MEM_ALLOC_ALG_TYPE
# unset CPU_AFFINITY_CONF
# unset TASK_QUEUE_ENABLE
# unset BIND_CPU
# unset HCCL_OP_EXPANSION_MODE

echo RANKTABLEFILE:$RANKTABLEFILE
echo MIES_CONTAINER_IP: $MIES_CONTAINER_IP